package com.manor.paradise.dialog

import android.content.Context
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.core.CenterPopupView
import com.lxj.xpopup.interfaces.OnSelectListener
import com.manor.common.utils.ToastUtil
import com.manor.common.utils.len
import com.manor.common.utils.str
import com.manor.paradise.R
import kotlinx.android.synthetic.main.dialog_set_deal_pwd.view.*

/**
 * 设置交易密码


 * @date  2020/6/24  10:11
 * @version 1.0
 */
class SetDealPwdDialog(context: Context,listener: OnSelectListener) : CenterPopupView(context) {

    companion object {
        fun load(context: Context, listener: OnSelectListener) {
            XPopup.Builder(context)
                    .dismissOnTouchOutside(false)
                    .dismissOnBackPressed(false)
                    .asCustom(SetDealPwdDialog(context, listener))
                    .show()
        }
    }


    override fun getImplLayoutId(): Int {
        return R.layout.dialog_set_deal_pwd
    }

    override fun onCreate() {
        super.onCreate()
        tvConfirm.setOnClickListener { submit() }
    }

    private fun submit(){
        if (etPwd.len()<6){
            ToastUtil.show("密码长度过低")
        }
        if (etPwd.str() != etPwdRetry.str()){
            ToastUtil.show("两次密码输入不一致")
            return
        }
    }





}